package com.landeb.shop.huo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.landeb.shop.R;
import com.landeb.shop.huo.bean.BeanFragGoodAddressLV;

import java.util.List;

/**
 * Created by blade on 2016/11/20.
 */

public class FragGoodBottomSheetLVAdapter extends BaseAdapter {

    private List<BeanFragGoodAddressLV.DataBean> mList;
    private LayoutInflater mInflater;
    private Context mContext;

    public FragGoodBottomSheetLVAdapter(Context context, List<BeanFragGoodAddressLV.DataBean> list) {
        mContext = context;
        mList = list;
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int i) {
        return mList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        ViewHolder holder = null;
        if (view == null) {

            view = mInflater.inflate(R.layout.item_frag_good_bottom_sheet_lv, viewGroup, false);

            holder = new ViewHolder();
            holder.mAddress = (TextView) view.findViewById(R.id.tv_address_item_fragGood_bottom_sheet_lv);

            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }

        holder.mAddress.setText(mList.get(i).getAddress());

//        Glide.with(mContext)
//                .load(picUrl)
//                .placeholder(R.drawable.error_pic)
//                .error(R.drawable.error_pic)
//                .crossFade()
//                .into(holder.mImageView);


        return view;


    }

    private class ViewHolder {
        private ImageView mIcon; //图标
        private TextView mAddress; //文字

    }
}
